import {defHttp} from '/@/utils/http/axios';
import {Modal} from 'ant-design-vue';

enum Api {
  queryById = '/bankRunningReportSet/queryById',
  list = '/bankRunningReportSet/list',
  save='/bankRunningReportSet/add',
  deleteOne = '/bankRunningReportSet/delete',
  deleteBatch = '/bankRunningReportSet/deleteBatch',
}

/**
 * 详情接口
 * @param params
 */
export const queryById = (params) => defHttp.get({url: Api.queryById, params});

/**
 * 列表接口
 * @param params
 */
export const list = (params) => defHttp.get({url: Api.list, params});

/**
 * 删除单个
 * @param params
 * @param handleSuccess
 */
export const deleteOne = (params,handleSuccess) => {
    Modal.confirm({
    title: '确认删除',
    content: '是否删除选中数据',
    okText: '确认',
    cancelText: '取消',
    onOk: () => {
      return defHttp.delete({url: Api.deleteOne, params}, {joinParamsToUrl: true}).then(() => {
        handleSuccess();
      });
    }
  });
}

/**
 * 保存或者更新
 * @param params
 * @param isUpdate 是否是更新数据
 */
export const saveOrUpdate = (params) => {
  return defHttp.post({url: Api.save, params}, {isTransformResponse:false});
}
